<?php
//ini_set("display_errors","1");
my_component_load('testing' , false);
my_component_load('paging' , false);  
my_component_load('a_tukar_shift' );
$task = isset($_GET['task']) ? $_GET['task'] : ""; 
$id = isset( $_GET['id'] ) ? $_GET['id']:  0;
$periode_id = isset( $_GET['periode_id'] ) ? $_GET['periode_id']:  0; 

$modulname = "Personalia _BN_ Waktu Kerja _BN_ Surat Permohonan Tukar Dinas";
 
if($_SERVER['REQUEST_METHOD'] == "POST" ):
	switch($task){
		case   "edit" :
			$validate = form_tukar_validate($id);
			if($validate){
				$content = message_multi_error($validate );
				$content .= form_tukar_create($id);
			}else{
				form_tukar_submit($id);
				my_direct('index.php?com=a_tukar_shift&periode_id='.$periode_id);
			}	
			break;
	}

else: 	
	if($task == "edit"){
		$pagename = $modulname." _BN_ ".(($id ==0) ? "Tambah Data" : "Perubahan Data" );
		$view = form_tukar_create($id);
	/*
	}elseif($task == 'batch'){ 
		tukar_shift_batch();
		my_direct('index.php?com='.$_GET['com']);
	*/
	}elseif($task == 'delete'){ 
		delete_tukar($id);
		my_direct('index.php?com=a_tukar_shift');
	}else{
		$pagename = $modulname ; 
		load_facebox_script(); 
		$view =  list_tukar($periode_id); 
	}
endif; 
generate_my_web($view, $pagename );
?>